local skel = fk.CreateSkill {
  name = "emo__zhenchajs",
}

Fk:loadTranslationTable{
  ["emo__zhenchajs"] = "侦查箭矢",
  [":emo__zhenchajs"] = "你对其他角色造成伤害后，可以观看其手牌；若其手牌数与你相同，获得其中一张。",

  ["#emo__zhenchajs-ask"] = "侦查箭矢：你可以观看 %src 手牌",
  ["#emo__zhenchajs_get"] = "获得",
  ["#emo__zhenchajs-watch"] = "观看其手牌中",

  ["$emo__zhenchajs1"] = "",
  ["$emo__zhenchajs2"] = "",
}

skel:addEffect(fk.Damage, {
  anim_type = "control",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and data.to ~= player and not data.to.dead and not data.to:isKongcheng()
  end,
  on_cost = function (self, event, target, player, data)
    if player.room:askToSkillInvoke(player, {skill_name = skel.name, prompt = "#emo__zhenchajs-ask:"..data.to.id }) then
      event:setCostData(self, { tos = {data.to} })
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local choices = {}
    if player:getHandcardNum() == data.to:getHandcardNum() then
      table.insert(choices, "#emo__zhenchajs_get")
    end
    local cards, _ = room:askToChooseCardsAndChoice(player, {
      prompt = "#emo__zhenchajs-watch",
      cards = data.to:getCardIds("h"), skill_name = skel.name, min_num = 1, max_num = 1,
      cancel_choices = {"Cancel"}, choices = choices,
    })
    if #cards > 0 then
      room:obtainCard(player, cards, false, fk.ReasonPrey, player, skel.name)
    end
  end,
})

return skel
